package com.aerozhonghuan.logisticsmall.framework.hybrid.actions;

import android.support.annotation.NonNull;
import android.support.annotation.Nullable;

import com.aerozhonghuan.hybrid.XJsCallback;
import com.aerozhonghuan.hybrid.utils.JsonObjectUtil;
import com.aerozhonghuan.logisticsmall.framework.hybrid.NewWebviewFragment;
import com.aerozhonghuan.logisticsmall.framework.hybrid.SimpleActionHandler;
import com.aerozhonghuan.logisticsmall.framework.hybrid.bean.JsMobileAgentConstants;

import org.json.JSONObject;

import java.util.HashMap;

/**
 * 描述
 * 作者 Zhang Yonghui
 * 创建日期 2019/1/21
 */
public class GoPageActionHandler extends SimpleActionHandler {
    private static final String TEST_PAGE = "JIFEN_STORE";
    private static final String KEY_PAGENAME = "pageName";
    private static final String KEY_ARGUMENNTS = "arguments";


    public GoPageActionHandler(NewWebviewFragment fragment) {
        super(JsMobileAgentConstants.FLAG_GOPAGE, fragment);
    }

    @Override
    public void handleAction(@NonNull String action, @Nullable JSONObject params, @Nullable XJsCallback callBack) {
        if (params == null) {
            return;
        }
        String pageName = params.optString(KEY_PAGENAME);
        String arguments = params.optString(KEY_ARGUMENNTS);
        HashMap<String, String> pageParams = JsonObjectUtil.jsonObjectStringToHasMap(arguments);
        if (pageName.equals(TEST_PAGE)) {

        }
    }
}
